var mySwiper = new Swiper('.swiper', {
    loop: true, // 循环模式选项
    // 如果需要分页器
    pagination: {
        el: '.swiper-pagination',
    },
    autoplay: {
        disableOnInteraction: false,
        delay: 2000,
    },

    // 如果需要前进后退按钮
    navigation: {
        nextEl: '.swiper-button-next',
        prevEl: '.swiper-button-prev',
    },

    // 如果需要滚动条
})

get('.swiper').addEventListener('mouseover', () => {
    mySwiper.autoplay.stop();
})
get('.swiper').addEventListener('mouseout', () => {
    mySwiper.autoplay.start();
})



//手动轮播图
var index = 1;
function lunbo() {
    index++;
    //判断index是否大于3
    if (index > 3) {
        index = 1;
    }
    //获取img对象
    var img = document.getElementById("lunbo_img");
    img.src = "../../assets/imgs/zgtxfw0" + index + ".png";
}
setInterval(lunbo, 2000);


let imgbg = '';//定义图片名称
getAll('.api li').forEach((x)=> {
    x.addEventListener('mouseover', ()=>{
        //获取图片的路径
        let path = x.children[0].src;
        //查找.的位置和/的位置
        let index1 = path.lastIndexOf('/');
        let index2 = path.lastIndexOf('.');
        //截取路径
        imgbg = path.slice(index1 + 1, index2)
        //设置图片的路径
        x.children[0].src = `../../assets/imgs/${imgbg}-c.svg`
    })
    x.addEventListener('mouseout', ()=> {
        x.children[0].src = `../../assets/imgs/${imgbg}.svg`
    })


})


